/*
 * Copyright (c) 2013 WDCY Information Technology Co. Ltd
 * www.wdcy.cc
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * WDCY Information Technology Co. Ltd ("Confidential Information").
 * You shall not disclose such Confidential Information and shall use
 * it only in accordance with the terms of the license agreement you
 * entered into with WDCY Information Technology Co. Ltd.
 */
package com.monkey.web.dto.response.permission;


import com.monkey.core.domain.permission.Permission;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Wu Tianqiang
 */
public class PermissionJSONDto {

    private String name;
    private String permission;
    private String description;

    public PermissionJSONDto(Permission permission) {
        this.name = permission.getName();
        this.permission = permission.getPermission();
        this.description = permission.getDescription();
    }

    public static List<PermissionJSONDto> toJSONDto(List<Permission> permissions) {
        List<PermissionJSONDto> permissionJSONDtos = new ArrayList<>();
        for (Permission permission : permissions) {
            permissionJSONDtos.add(new PermissionJSONDto(permission));
        }
        return permissionJSONDtos;
    }


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPermission() {
        return permission;
    }

    public void setPermission(String permission) {
        this.permission = permission;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }
}